<script setup lang="ts">
import { onMounted, ref } from "vue";

const aDom = ref(null);
const btnDom = ref(null)
onMounted(()=>{
    if(aDom.value){
        const dom = aDom.value as HTMLAnchorElement
        dom.href = 'https://www.qq.com'
    }
    if(btnDom.value){
        const dom = btnDom.value as HTMLButtonElement
        dom.onclick=()=>{
            alert("这是脱裤子放屁的一种写法")
        }
    }
})
</script>

<template>
  <div>
    <a href="https://www.baidu.com" ref="aDom">百度</a>
    <button ref="btnDom">按钮</button>
  </div>
</template>

<style scoped></style>
